package com.yange.accountbook.ui.adapter

import android.widget.ImageView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.yange.accountbook.R
import com.yange.accountbook.entity.BooksEntity
import com.yange.accountbook.utils.StringUtils
import com.yange.accountbook.utils.image.loadCircleImg

class BookListAdapter :
    BaseQuickAdapter<BooksEntity, BaseViewHolder>(R.layout.books_list_item_layout) {
    override fun convert(holder: BaseViewHolder, item: BooksEntity) {
        holder.setText(R.id.tv_book_name, item.name)
        holder.setText(R.id.tv_money, "￥" + StringUtils.getNoMoreThanTwoDigits(item.money))
        var image = holder.getView<ImageView>(R.id.iv_book_icon)
        context.loadCircleImg(image, item.icon)
    }
}